Skip to content

feat: enhance show current with generator ACL and interface filtering#507

Open
vaneuk wants to merge 2 commits intoannetutil:mainfrom
vaneuk:feature/show-current-filtering
Open

feat: enhance show current with generator ACL and interface filtering#507
vaneuk wants to merge 2 commits intoannetutil:mainfrom
vaneuk:feature/show-current-filtering

Conversation

@vaneuk
Copy link
Copy Markdown

@vaneuk vaneuk commented Apr 3, 2026

New flags

Flag Behaviour
(none) Unchanged — returns full running config
--acl Applies all generator ACLs — scopes output to config sections managed by annet
-g <tag> Implies --acl, limits output to generators matching the tag
-i <iface> Implies --acl, limits output to the specified interface(s)

Example workflow

Generate desired config and fetch the matching slice of current config for a single interface:

annet gen          -g interface -i Ethernet50 --dest generated/  router1.example.com
annet show current -g interface -i Ethernet50 --dest current/    router1.example.com

Produce a patch (commands to apply) and a rollback (commands to revert):

annet file-patch --hw Arista current/ generated/   # patch
annet file-patch --hw Arista generated/ current/   # rollback

Implementation notes

old_raw (used by the previous show current) fetched config as raw text with no generator involvement. This PR replaces it with old_new(..., no_new=True), which runs the same fetch + ACL filtering pipeline already used by annet gen and annet patch.

Ivan Sinyagovskiy and others added 2 commits April 3, 2026 16:20
Add -g, -i, and --acl flags to `annet show current`:
- Default behaviour unchanged: shows full device config
- --acl: applies all generator ACLs to scope output to managed config
- -g / -i: imply --acl, further scope output to specific generators or interfaces

Remove old_raw and _gen_current_items (no remaining callers) and reuse
existing old_new with no_new=True, eliminating duplicated fetch logic.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant